// Copyright (c) 2009 Mike Haight, Andy Kipp
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.

#include "stdafx.h"

Particle::Particle(ParticleSettings^ argSettings) : mSettings(argSettings)
{
}


Coordinates::Location% Particle::Origin::get(void)
{
    return mOrigin;
}


void Particle::Origin::set(Coordinates::Location% value)
{
    mOrigin = value;
}


Coordinates::Location% Particle::Location::get(void)
{
    return mLocation;
}


void Particle::Location::set(Coordinates::Location% value)
{
    mLocation = value;
}


Coordinates::Size% Particle::Size::get(void)
{
    return mSize;
}


void Particle::Size::set(Coordinates::Size% value)
{
    mSize = value;
}


int Particle::Life::get(void)
{
    return mLife;
}


void Particle::Life::set(int value)
{
    mLife = value;
}


int Particle::Lifespan::get(void)
{
    return mLifespan;
}


void Particle::Lifespan::set(int value)
{
    mLifespan = value;
}


ParticleSettings^ Particle::Settings::get(void)
{
    return mSettings;
}

void Particle::Begin(void)
{
    // Get ParticleSettings
    ParticleSettings^ settings = mSettings;

    // Set Lifespan for Particle
    Lifespan = smRandom->Next(settings->MinLifespan, settings->MaxLifespan + 1);
    Life = Lifespan;
}


void Particle::End(void)
{
    Life = 0;
}
